# -*- coding: utf-8 -*-
# @Time    : 2022/1/11 16:32
# @Author  : 徐翊宸
# @Email   : xyc@163.com
# @File    : page_yxtj.py
# @Software: PyCharm
from selenium.webdriver.common.by import By
from selenium.webdriver.support.select import Select
from pages.base_page import BasePage

class YxtjPage(BasePage):

    toux_locator = (By.CSS_SELECTOR, "body > div.navbar.navbar-inverse.navbar-fixed-top > div > div > div.nav-collapse.collapse > ul.nav.pull-right > li:nth-child(6) > a > img")
    zzjg_locator = (By.CSS_SELECTOR, "body > div.navbar.navbar-inverse.navbar-fixed-top > div > div > div.nav-collapse.collapse > ul.nav.pull-right > li.dropdown.open > ul > li:nth-child(4) > a")
    tjyh_submit_locator = (By.LINK_TEXT, "添加用户")
    yxyq_submit_locator = (By.LINK_TEXT, "邮箱邀请")
    tjyhm_locator = (By.CLASS_NAME, "span3")
    tjyouxiang_locator = (By.CSS_SELECTOR, "#email")
    xzyhlb_locator = (By.CSS_SELECTOR, "#add > table > tbody > tr:nth-child(3) > td:nth-child(2) > select")
    xzbm_locator = (By.ID, "department")
    tj_locator = (By.CSS_SELECTOR, "#add > table > tbody > tr:nth-child(6) > td:nth-child(2) > input:nth-child(1)")

    def toux_click(self):
        self.driver.find_element(*self.toux_locator).click()

    def zzjg_click(self):
        self.driver.find_element(*self.zzjg_locator).click()

    def tjyh_click(self):
        self.driver.find_element(*self.tjyh_submit_locator).click()

    def yxyq_click(self):
        self.driver.find_element(*self.yxyq_submit_locator).click()

    def tjyhm_input(self, yhm):
        self.driver.find_element(*self.tjyhm_locator).send_keys(yhm)

    def tjyouxiang_input(self, tjyouxiang):
        self.driver.find_element(*self.tjyouxiang_locator).send_keys(tjyouxiang)

    def xzyhlb_xz(self):
        xzyhlb_select_element = self.driver.find_element(*self.xzyhlb_locator)
        xzyhlb_select = Select(xzyhlb_select_element)
        xzyhlb_select.select_by_index(2)

    def xzbm_xz(self):
        xzbm_select_element = self.driver.find_element(*self.xzbm_locator)
        xzbm_select = Select(xzbm_select_element)
        xzbm_select.select_by_index(1)

    def tj_click(self):
        self.driver.find_element(*self.tj_locator).click()














